home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / About.frm < prev    next >
Text File  |  1997-06-14  |  12KB  |  409 lines

  1. VERSION 5.00
  2. Begin VB.Form FAbout 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "About"
  5.    ClientHeight    =   5325
  6.    ClientLeft      =   1650
  7.    ClientTop       =   2955
  8.    ClientWidth     =   6480
  9.    FillStyle       =   3  'Vertical Line
  10.    BeginProperty Font 
  11.       Name            =   "MS Sans Serif"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   700
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    KeyPreview      =   -1  'True
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   5325
  24.    ScaleWidth      =   6480
  25.    Begin VB.PictureBox pbAnimate 
  26.       Appearance      =   0  'Flat
  27.       BackColor       =   &H00C0C0C0&
  28.       BorderStyle     =   0  'None
  29.       ForeColor       =   &H80000008&
  30.       Height          =   1308
  31.       Left            =   30
  32.       ScaleHeight     =   1305
  33.       ScaleWidth      =   1170
  34.       TabIndex        =   10
  35.       Top             =   1395
  36.       Width           =   1176
  37.    End
  38.    Begin VB.Frame fmUserInfo 
  39.       BackColor       =   &H00C0C0C0&
  40.       Height          =   975
  41.       Left            =   1290
  42.       TabIndex        =   5
  43.       Top             =   2730
  44.       Width           =   5055
  45.       Begin VB.Label lblUserInfo 
  46.          BackColor       =   &H00C0C0C0&
  47.          Caption         =   "UserInfo"
  48.          Height          =   210
  49.          Index           =   2
  50.          Left            =   150
  51.          TabIndex        =   9
  52.          Top             =   630
  53.          Width           =   4800
  54.       End
  55.       Begin VB.Label lblUserInfo 
  56.          BackColor       =   &H00C0C0C0&
  57.          Caption         =   "UserInfo"
  58.          Height          =   210
  59.          Index           =   1
  60.          Left            =   150
  61.          TabIndex        =   8
  62.          Top             =   420
  63.          Width           =   4860
  64.       End
  65.       Begin VB.Label lblUserInfo 
  66.          BackColor       =   &H00C0C0C0&
  67.          Caption         =   "UserInfo"
  68.          Height          =   210
  69.          Index           =   0
  70.          Left            =   150
  71.          TabIndex        =   6
  72.          Top             =   210
  73.          Width           =   4830
  74.       End
  75.    End
  76.    Begin VB.CommandButton cmdInfo 
  77.       Caption         =   "&System Info..."
  78.       Height          =   330
  79.       Left            =   4575
  80.       TabIndex        =   1
  81.       Top             =   4365
  82.       Width           =   1680
  83.    End
  84.    Begin VB.CommandButton cmdOK 
  85.       Cancel          =   -1  'True
  86.       Caption         =   "&OK"
  87.       Default         =   -1  'True
  88.       Height          =   345
  89.       Left            =   4575
  90.       TabIndex        =   0
  91.       Top             =   3945
  92.       Width           =   1695
  93.    End
  94.    Begin VB.Label lblMode 
  95.       BackColor       =   &H00C0C0C0&
  96.       Caption         =   "Mode"
  97.       Height          =   255
  98.       Left            =   1350
  99.       TabIndex        =   21
  100.       Top             =   1335
  101.       Width           =   3870
  102.    End
  103.    Begin VB.Label lbl 
  104.       BackColor       =   &H00C0C0C0&
  105.       Caption         =   "Virtual Memory:"
  106.       Height          =   225
  107.       Index           =   1
  108.       Left            =   1350
  109.       TabIndex        =   20
  110.       Top             =   1785
  111.       Width           =   1815
  112.    End
  113.    Begin VB.Label lbl 
  114.       BackColor       =   &H00C0C0C0&
  115.       Caption         =   "Memory Load:"
  116.       Height          =   225
  117.       Index           =   2
  118.       Left            =   1350
  119.       TabIndex        =   19
  120.       Top             =   2010
  121.       Width           =   1815
  122.    End
  123.    Begin VB.Label lbl 
  124.       BackColor       =   &H00C0C0C0&
  125.       Caption         =   "Physical Memory:"
  126.       Height          =   225
  127.       Index           =   0
  128.       Left            =   1350
  129.       TabIndex        =   18
  130.       Top             =   1560
  131.       Width           =   1815
  132.    End
  133.    Begin VB.Label lbl 
  134.       BackColor       =   &H00C0C0C0&
  135.       Caption         =   "Machine:"
  136.       Height          =   225
  137.       Index           =   3
  138.       Left            =   1350
  139.       TabIndex        =   17
  140.       Top             =   2460
  141.       Width           =   1815
  142.    End
  143.    Begin VB.Label lbl 
  144.       BackColor       =   &H00C0C0C0&
  145.       Caption         =   "User:"
  146.       Height          =   225
  147.       Index           =   4
  148.       Left            =   1350
  149.       TabIndex        =   16
  150.       Top             =   2235
  151.       Width           =   1815
  152.    End
  153.    Begin VB.Label lblVirtualMemory 
  154.       BackColor       =   &H00C0C0C0&
  155.       Caption         =   "xxx"
  156.       Height          =   216
  157.       Left            =   3240
  158.       TabIndex        =   15
  159.       Top             =   1785
  160.       Width           =   2412
  161.    End
  162.    Begin VB.Label lblPhysicalMemory 
  163.       BackColor       =   &H00C0C0C0&
  164.       Caption         =   "xxx"
  165.       Height          =   216
  166.       Left            =   3240
  167.       TabIndex        =   14
  168.       Top             =   1560
  169.       Width           =   2412
  170.    End
  171.    Begin VB.Label lblMemoryLoad 
  172.       BackColor       =   &H00C0C0C0&
  173.       Caption         =   "xxx"
  174.       Height          =   216
  175.       Left            =   3240
  176.       TabIndex        =   13
  177.       Top             =   2010
  178.       Width           =   2412
  179.    End
  180.    Begin VB.Label lblUser 
  181.       BackColor       =   &H00C0C0C0&
  182.       Caption         =   "xxx"
  183.       Height          =   216
  184.       Left            =   3240
  185.       TabIndex        =   12
  186.       Top             =   2235
  187.       Width           =   2412
  188.    End
  189.    Begin VB.Label lblMachine 
  190.       BackColor       =   &H00C0C0C0&
  191.       Caption         =   "xxx"
  192.       Height          =   216
  193.       Left            =   3240
  194.       TabIndex        =   11
  195.       Top             =   2460
  196.       Width           =   2412
  197.    End
  198.    Begin VB.Label lblVersion 
  199.       BackColor       =   &H00C0C0C0&
  200.       Caption         =   "Version"
  201.       Height          =   255
  202.       Left            =   135
  203.       TabIndex        =   7
  204.       Top             =   4995
  205.       Width           =   5745
  206.    End
  207.    Begin VB.Line Line1 
  208.       X1              =   165
  209.       X2              =   6360
  210.       Y1              =   3720
  211.       Y2              =   3720
  212.    End
  213.    Begin VB.Label lblComment 
  214.       BackColor       =   &H00C0C0C0&
  215.       Caption         =   "Warning:"
  216.       BeginProperty Font 
  217.          Name            =   "MS Sans Serif"
  218.          Size            =   8.25
  219.          Charset         =   0
  220.          Weight          =   400
  221.          Underline       =   0   'False
  222.          Italic          =   0   'False
  223.          Strikethrough   =   0   'False
  224.       EndProperty
  225.       Height          =   1005
  226.       Left            =   150
  227.       TabIndex        =   4
  228.       Top             =   3960
  229.       Width           =   4185
  230.       WordWrap        =   -1  'True
  231.    End
  232.    Begin VB.Label lblRights 
  233.       BackColor       =   &H00C0C0C0&
  234.       Caption         =   "Copyright "
  235.       Height          =   390
  236.       Left            =   1350
  237.       TabIndex        =   3
  238.       Top             =   840
  239.       Width           =   3975
  240.    End
  241.    Begin VB.Label lblApp 
  242.       BackColor       =   &H00C0C0C0&
  243.       Caption         =   "My Application"
  244.       Height          =   240
  245.       Left            =   1350
  246.       TabIndex        =   2
  247.       Top             =   240
  248.       Width           =   3975
  249.    End
  250.    Begin VB.Image imgIcon 
  251.       Height          =   480
  252.       Left            =   405
  253.       Top             =   285
  254.       Width           =   480
  255.    End
  256. End
  257. Attribute VB_Name = "FAbout"
  258. Attribute VB_GlobalNameSpace = False
  259. Attribute VB_Creatable = False
  260. Attribute VB_PredeclaredId = True
  261. Attribute VB_Exposed = False
  262. Option Explicit
  263.  
  264. '$ UTILITY.BAS
  265.  
  266. Public Client As App
  267. Public ClientIcon As StdPicture
  268. Public InfoProg As String
  269. Public Copyright As String
  270. Public Comments As String
  271. Public SecretButton As Integer
  272. Public SecretKey As Integer
  273. Public SecretShift As Integer
  274.  
  275. Private fError As Boolean, fStop As Boolean
  276. Private asUserInfo(1 To 3) As String
  277.  
  278. Private anim As IAnimation
  279.  
  280. Sub Form_Load()
  281. With Client
  282.     BugMessage "Loading About"
  283.     If anim Is Nothing Then Set anim = New CButterFly
  284.     Set anim.Canvas = pbAnimate
  285.     Me.Caption = "About " & .ProductName
  286.     lblApp.Caption = .Title
  287.     Const sInfo = "\msapps\msinfo\msinfo32.exe"
  288.     ' Allow override because some customers might not have MSINFO
  289.     If InfoProg = sEmpty Then
  290.         InfoProg = System.WindowsDir & sInfo
  291.     End If
  292.     If ExistFile(InfoProg) = False Then cmdInfo.Visible = False
  293.         
  294.     ' Icon from first form is application icon
  295.     If Not ClientIcon Is Nothing Then
  296.         If ClientIcon.Type = vbPicTypeIcon Then
  297.             Set Me.Icon = ClientIcon
  298.         End If
  299.         Set imgIcon.Picture = ClientIcon
  300.     End If
  301.     lblMode.Caption = System.Mode & " on " & System.Processor
  302.     lblPhysicalMemory.Caption = System.FreePhysicalMemory & _
  303.         " KB of " & System.TotalPhysicalMemory & " KB"
  304.     lblVirtualMemory.Caption = System.FreeVirtualMemory & _
  305.         " KB of " & System.TotalVirtualMemory & " KB"
  306.     lblMemoryLoad.Caption = System.MemoryLoad & "%"
  307.     lblUser.Caption = System.User
  308.     lblMachine.Caption = System.Machine
  309.     If UserInfo(1) = sEmpty And UserInfo(2) = sEmpty And _
  310.                                 UserInfo(3) = sEmpty Then
  311.         fmUserInfo.Visible = False
  312.     Else
  313.         fmUserInfo.Visible = True
  314.         lblUserInfo(0).Caption = UserInfo(1)
  315.         lblUserInfo(1).Caption = UserInfo(2)
  316.         lblUserInfo(2).Caption = UserInfo(3)
  317.     End If
  318.     If Copyright = sEmpty Then Copyright = .LegalCopyright
  319.     lblRights.Caption = Copyright
  320.     If Comments = sEmpty Then Comments = .Comments
  321.     lblComment.Caption = Comments
  322.     lblVersion.Caption = "Version " & .Major & "." & .Minor
  323. End With
  324. End Sub
  325.  
  326. Private Sub Form_Unload(Cancel As Integer)
  327.     ' Clean up UserInfo--it must be set before each load
  328.     asUserInfo(1) = sEmpty
  329.     asUserInfo(2) = sEmpty
  330.     asUserInfo(3) = sEmpty
  331.     Set anim = Nothing
  332. End Sub
  333.  
  334. Private Sub Form_Initialize()
  335.     BugMessage "Initializing About"
  336. End Sub
  337.  
  338. Private Sub Form_Terminate()
  339.     BugMessage "Terminating About"
  340. End Sub
  341.  
  342. Private Sub Form_Activate()
  343.     BugMessage "Activating About"
  344.     ' Default for undocumented secret feature!
  345.     If SecretButton = 0 Then SecretButton = vbRightButton
  346.     If SecretKey = 0 Then SecretKey = vbKeySubtract
  347.     If SecretShift = 0 Then SecretShift = vbShiftMask Or vbAltMask
  348.     fStop = True
  349. End Sub
  350.  
  351. Private Sub cmdInfo_Click()
  352.     On Error GoTo InfoFail
  353.     Shell InfoProg, vbNormalFocus
  354.     Exit Sub
  355. InfoFail:
  356.     MsgBox "Can't find information program"
  357. End Sub
  358.  
  359. Private Sub cmdOK_Click()
  360.     fStop = True
  361.     DoEvents
  362.     Me.Hide
  363. End Sub
  364.  
  365. Property Get Animator() As IAnimation
  366.     Set Animator = anim
  367. End Property
  368.  
  369. Property Set Animator(ia As IAnimation)
  370.     Set anim = ia
  371. End Property
  372.  
  373. Property Get UserInfo(i As Integer) As String
  374.     Select Case i
  375.     Case 1 To 3
  376.         UserInfo = asUserInfo(i)
  377.     Case Else
  378.         UserInfo = sEmpty
  379.     End Select
  380. End Property
  381.  
  382. Property Let UserInfo(i As Integer, asUserInfoA As String)
  383.     Select Case i
  384.     Case 1 To 3
  385.         asUserInfo(i) = asUserInfoA
  386.     End Select
  387. End Property
  388.  
  389. Property Get Error() As Boolean
  390.     Error = fError
  391. End Property
  392.  
  393. ' Undocumented secret feature!
  394. Private Sub pbAnimate_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
  395.     If Button = SecretButton Then
  396.         anim.Running = Not anim.Running
  397.     End If
  398. End Sub
  399.  
  400. ' Undocumented secret feature!
  401. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  402.     If KeyCode = SecretKey Then
  403.         If Shift And SecretShift Then
  404.             anim.Running = Not anim.Running
  405.         End If
  406.     End If
  407. End Sub
  408.  
  409.